﻿using DevExpress.XtraGrid.Demos.util;
using DXApplicationTangche.DTO;
using mendian;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DXApplicationTangche.UC.面料库存.面料出库.service
{
    public class StockOutService
    {
        
    }
    public class DTO订单出库记录员工
    {
        public String mnemonic { get; set; }
        public String code { get; set; }
        public String id { get; set; }
        public String orderDetails { get; set; }
        public DTO订单出库记录员工()
        {

        }
    }

    /// <summary>
    /// 订单领料出库明细总览DTO
    /// </summary>
    public class DTO订单领料出库明细总览
    {
        public List<DTO订单领料出库单> orderDetails { get; set; } = new List<DTO订单领料出库单>();   //  订单明细
        public List<DTO订单领料出库明细> summaries { get; set; } = new List<DTO订单领料出库明细>();   //  合计数
        public Dictionary<String, List<DTO异常>> stringListMap { get; set; } = new Dictionary<string, List<DTO异常>>();//异常调整
        public DTO订单领料出库明细总览()
        {

        }
    }

    /// <summary>
    /// 订单领料申请DTO
    /// </summary>
    public class DTO订单领料出库
    {
        public String id { get; set; }
        public String billNo { get; set; }                  //出库单号
        public String orderTypeId { get; set; }
        public String orderTypeName { get; set; }           //订单类型
        public String orderCustomerTypeId { get; set; }
        public String orderCustomerTypeName { get; set; }   //客户名称
        public Double applyCount { get; set; }              //申请单数
        public DTO订单领料出库()
        {

        }
    }

    public class DTO订单领料出库单
    {
        public String applyId { get; set; }    //  申请ID
        public String orderId { get; set; } //订单id
        public String orderNo { get; set; }  //订单号
        public String continuity { get; set; }    //  延续性
        public Double fabricQuanlity { get; set; } //库存数量
        public Double unitPrice { get; set; }   //库存成本
        public Double applyCount { get; set; } //申请数量
        public String materialCode { get; set; }     //物料编码
        public Double justifyQuantity { get; set; } //  调整数量
        public List<DTO异常> 异常调整 { get; set; } = new List<DTO异常>();
        public DTO订单领料出库单()
        {
        }
        /// <summary>
        /// 计算异常的调整值
        /// </summary>
        /// <returns></returns>
        public DTO订单领料出库单 build计算调整值()
        {
            this.justifyQuantity = 0;
            foreach (DTO异常 item in this.异常调整)
            {
                this.justifyQuantity = this.justifyQuantity + Convert.ToDouble(item.justifyValue);
            }
            return this;
        }
    }
    public class DTO异常
    {
        public string id { get; set; }     //id
        public string justifyReason { get; set; }  //  调整原因
        public Double justifyValue { get; set; }//  调整值
        public DateTime justifyDate { get; set; }//  调整时间
        public DTO异常()
        {

        }

        public DTO异常(
            string justifyReason,
            Double justifyValue,
            DateTime justifyDate)
        {
            this.id = new FunctionHelper().Uuid;
            this.justifyReason = justifyReason;
            this.justifyValue = justifyValue;
            this.justifyDate = justifyDate;
        }
    }
    public class DTO订单领料出库明细
    {
        public String id { get; set; }    //  ID
        public String vendorName { get; set; }    //  供货商
        public String materialNo { get; set; }    //  面料号
        public String meterialDesc { get; set; }    //  描述名称
        public String composition { get; set; }    //  成分
        public String density { get; set; }    //  纱织密度
        public String weight { get; set; }    //  克重
        public String width { get; set; }    //  幅宽
        public String thick { get; set; }    //  厚度
        public String elastic { get; set; }    //  弹力
        public String feature { get; set; }    //  面料特性注意
        public String continuity { get; set; }    //  延续性
        public String uasge { get; set; }    //  用途
        public String inspectionResults { get; set; }    //  验料结果
        public String color { get; set; }    //  颜色
        public String season { get; set; }    //  季节
        public String style { get; set; }    //  风格
        public String arrangementMethod { get; set; }    //  整理方式
        public Double fabricQuanlity { get; set; } //库存数量
        public Double unitPrice { get; set; }   //库存成本
        public Double applyCount { get; set; }   //申请数量
        public Double totalQuantity { get; set; }    //  总数量
        public DTO订单领料出库明细()
        {
        }
    }
}
